
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	xmlns:mywidgets="http://xmlns.jcp.org/jsf/composite/widgets"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
>

<ui:composition template="/templates/photoTemplate.xhtml">

	<ui:define name="title">
		#{i18N.getTrans('myReservations')}
	</ui:define>

	<ui:define name="navReferences">
	</ui:define>

	<ui:define name="body">

		<h1>#{i18N.getTrans('myReservations')}</h1>

		<h:form>

			<p class="betweenSections" />

			<h:dataTable id="resTable"
				value="#{userReservationController.findAllReservationsByTenantId()}"
				var="reservation" styleClass="data-table" headerClass="table-header"
				rowClasses="table-odd-row,table-even-row"
				columnClasses="reservationColumnCenter,reservationColumnCenter,reservationColumnCenter,reservationColumnCenter,reservationColumnMoney,reservationColumnMoney"
			>

				<h:column>
					<!-- column header -->
					<f:facet name="header">#{i18N.getTrans('State')}</f:facet>
					<!-- row record -->
    					#{i18N.getTrans(reservation.reservationState)}
    			</h:column>
				<h:column>
					<f:facet name="header">#{i18N.getTrans('NumberOfGuests')}</f:facet>
    				#{reservation.numberOfGuests}
    			</h:column>

				<h:column>
					<f:facet name="header">#{i18N.getTrans('Start')}<br />#{i18N.getTrans('End')}</f:facet>
					<span title="rental request received on #{reservation.dateCreated}">
						<h:outputText value="#{reservation.startDate}">
							<f:convertDateTime pattern="d. MMM. yy" />
							<br />
						</h:outputText><br /> <h:outputText value="#{reservation.endDate}">
							<f:convertDateTime pattern="d. MMM. yy" />
						</h:outputText>
					</span>
				</h:column>
				<h:column>
					<f:facet name="header">#{i18N.getTrans('Days/Nights')}</f:facet>   
						#{reservationController.getNumberOfDays(reservation)} 
						/ #{reservationController.getNumberOfDays(reservation) - 1}			
    			</h:column>
				<h:column>
					<f:facet name="header">#{i18N.getTrans('Total')}</f:facet>
					<h:outputText value="#{reservation.costs.totalCosts}">
						<f:convertNumber type="currency" currencySymbol="€"
							maxFractionDigits="2"
						/>
					</h:outputText>
				</h:column>
				<h:column headerClass="table-header-sub">
					<f:facet name="header">#{i18N.getTrans('Rent')}<br />#{i18N.getTrans('Cleaning')}<br />#{i18N.getTrans('Tax')}</f:facet>
					<h:outputText value="#{reservation.costs.reservationCosts}">
						<f:convertNumber type="currency" currencySymbol="€"
							maxFractionDigits="2"
						/>
					</h:outputText>
					<br />
					<h:outputText value="#{reservation.costs.cleaningFee}">
						<f:convertNumber type="currency" currencySymbol="€"
							maxFractionDigits="2"
						/>
					</h:outputText>
					<br />
					<h:outputText value="#{reservation.costs.vatAmount}">
						<f:convertNumber type="currency" currencySymbol="€"
							maxFractionDigits="2"
						/>
					</h:outputText>
				</h:column>

			</h:dataTable>

		</h:form>


	</ui:define>
</ui:composition>
</html>
